package com.ciwong.epaper.modules.epaper.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ciwong.epaper.R;
import com.ciwong.epaper.modules.bookstore.bean.PublishWorkContent;

import java.util.List;

public class PublishWorkContentListAdapter extends BaseAdapter {

    private List<PublishWorkContent> workNames;

    private Context mContext;


    public PublishWorkContentListAdapter(List<PublishWorkContent> workNames,Context mContext){
        this.workNames = workNames;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return workNames.size() == 0 ? 0 : workNames.size();
    }

    @Override
    public Object getItem(int i) {

        return workNames.size() == 0 ? null : workNames.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = View.inflate(mContext, R.layout.activity_publish_work_content_item, null);
        TextView publish_work_name = view.findViewById(R.id.publish_work_name);
        publish_work_name.setText(workNames.get(i).getResourceName());
        return view;
    }
}
